package com.jjj.springmvc.controller;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.alibaba.druid.pool.DruidDataSource;

@Controller
public class test {
	
	@Autowired
	DruidDataSource dataSource;
	
	@Autowired
	public JdbcTemplate getJdbcTemplate() { 
		return new JdbcTemplate(this.dataSource);
	}
	
	@RequestMapping("/her")
	public void name(HttpServletResponse res) throws IOException {
		List<Map<String,Object>> list = getJdbcTemplate().queryForList("select * from user");
		System.out.println(list.toString());
		res.getWriter().println("hello");
		
	}
}
